package com.zuorenke.rabbit;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author Z.R.K
 * @description
 * @create 2019-05-20 14:43:54
 **/
@Component
@Slf4j
public class RabbitMQListener {
	
	@Resource
	private RabbitMQSender fileErrorSender;
	
	@RabbitListener(bindings = @QueueBinding(
			value = @Queue(value = "${rabbit.queues.repository}", durable = "true"),
			exchange = @Exchange(value = "${rabbit.exchanges.repository}"),
			key = "${rabbit.queues.repository}"), concurrency = "5")
	public void repository(String message){
		log.info("消费 {}", message);
	}
	
	@RabbitListener(bindings = @QueueBinding(
			value = @Queue(value = "${rabbit.queues.bind-lesson}", durable = "true"),
			exchange = @Exchange(value = "${rabbit.exchanges.bind-lesson}"),
			key = "${rabbit.queues.bind-lesson}"), concurrency = "5")
	public void bindLesson(String message){
		log.info("消费 {}", message);
	}
	
	@RabbitListener(bindings = @QueueBinding(
			value = @Queue(value = "${rabbit.queues.load-course-ware}", durable = "true"),
			exchange = @Exchange(value = "${rabbit.exchanges.load-course-ware}"),
			key = "${rabbit.queues.load-course-ware}"), concurrency = "5")
	public void loadCourseWare(String message){
		log.info("消费 {}", message);
	}
}
